package com.autumn.chat.task;

import com.autumn.chat.config.GlobalParam;
import com.autumn.chat.http.DoBLiveApi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ProjectHearBeatTask extends Thread {

    private static final Logger log = LoggerFactory.getLogger(ProjectHearBeatTask.class);

    @Override
    public void run() {

        while (GlobalParam.PROJECT_STARTED) {
            log.info("game ID : {}", GlobalParam.GAME_ID);
            String result = DoBLiveApi.sendHearBeat(GlobalParam.GAME_ID);

            log.info("game ID : {} 返回内容 - {}", GlobalParam.GAME_ID, result);

            try {
                Thread.sleep(19000);
            } catch (InterruptedException e) {
                log.error("",e);
            }
        }

        log.info("心跳检测任务检测到项目关闭 进程关闭 - game ID : {} ====================", GlobalParam.GAME_ID );
    }
}
